#ifndef	_UART_H
#define	_UART_H

#define UART_BASE        0xffe7014000


#define UART_RBR    0
#define UART_DLL    0
#define UART_THR    0
#define UART_DLH    4
#define UART_IER    4
#define UART_FCR    8
#define UART_IIR    8
#define UART_LCR    0xc
#define UART_MCR    0x10
#define UART_LSR    0x14
#define UART_DLF    0xc0
#define UART_SFE    0x98


#define XMODME_RECEIVE_TIMEOUT      0x100000

#define SOH  0x1
#define STX  0x2
#define ETX  0x3
#define EOT  0x4
#define ACK  0x6
#define NACK  0x15
#define CAN  0x18
#define CTRLZ 0x1a

#define  CPU_TIMER_FREQUECTY 3000000

#define UART_XMODEM_TIMEOUT   600

#define  MDELAY_TICKS   (CPU_TIMER_FREQUECTY / 1000)
#define  UDELAY_TICKS   (CPU_TIMER_FREQUECTY / 1000 / 1000)


#ifndef __ASSEMBLER__

int uart_init(unsigned int uart_clk, unsigned int baud_rate);
void uart_putc(unsigned char ch);
void uart_puts(unsigned char *str);
int uart_getc(unsigned char *ch, uint64_t timeout_ms);
int uart_flush_data();
void print_u32(unsigned int num);
void mdelay(unsigned long ms);
void udelay(unsigned long us);

#endif


#endif  /*_UART_H */
